package com.example.demo.controller.lxy;

import com.example.demo.entity.Role_User;
import com.example.demo.service.lxy.RoleUserService;
import com.example.demo.entity.User;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import java.sql.Date;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
@Api("系统")
@RestController
public class RoleUserController {
    @Autowired
    RoleUserService roleUserService;
    @RequestMapping(value = "findAll",method = RequestMethod.POST)
    @ApiOperation("用户全查")
    public List<Role_User> findAll(){
        List<Role_User> userList= roleUserService.findAll();
        return userList;
    }
    @RequestMapping(value = "findByid",method = RequestMethod.POST)
    @ApiOperation("用户姓名查")
    public List<Role_User> findByid(int userid){
        List<Role_User> roleUserList= roleUserService.findByid(userid);
        return roleUserList;
    }
    @RequestMapping(value = "insertUser",method = RequestMethod.POST)
    @ApiOperation("添加用户")
    public List<Role_User> insertUser(int userid,int roleid){
        List<Role_User> roleUserList = roleUserService.insertUser(userid, roleid);
        return roleUserList;
    }
    @RequestMapping(value = "deleteUser",method = RequestMethod.POST)
    @ApiOperation("删除用户")
    public List<Role_User> deleteUser(int userid){
       List<Role_User> single = roleUserService.delectUser(userid);
        return single;
    }
    @RequestMapping(value = "updateUser",method = RequestMethod.POST)
    @ApiOperation("更新用户")
    public List<Role_User> updateUser(int userid,int roleid){
        List<Role_User> userList = roleUserService.upadeUser(userid,roleid);
        return userList;
    }
}